package org.teamh.gui.login;

import java.util.TimerTask;

import de.lessvoid.nifty.render.NiftyImage;

public class Background extends TimerTask{
	private LoginScreen login;
	private NiftyImage[] background1024 = new NiftyImage[5];
	private int num;

	public Background(LoginScreen loginScreen) {
		login=loginScreen;
		
		background1024[0]=login.getGui().getNifty().getRenderEngine().createImage("res/background/1_1024.jpg", true);
		background1024[1]=login.getGui().getNifty().getRenderEngine().createImage("res/background/2_1024.jpg", true);
		background1024[2]=login.getGui().getNifty().getRenderEngine().createImage("res/background/3_1024.jpg", true);
		background1024[3]=login.getGui().getNifty().getRenderEngine().createImage("res/background/4_1024.jpg", true);
		background1024[4]=login.getGui().getNifty().getRenderEngine().createImage("res/background/5_1024.jpg", true);
	}

	@Override
	public void run() {
		num=(int) ((Math.random()*5));
		login.setCurrentBackground1024(background1024[num]);	
	}

}
